#!/bin/bash
a=`git log --pretty=format:"%s" -1`

build_trigger='#build'
event_source='manual'
# 判断是否手动执行
if [ ${event_source} = 'manual' ]; then
    echo "手动触发, 跳过 commit message 检测."
    exit 1
else
	echo "被动触发, 执行 commit message 检测."
fi
echo ${event_source}
# 判断webhooks commit message
if echo ${a} | grep -q ${build_trigger}
then
	echo "检测到 commit message 中包含 ${build_trigger}, 即将执行build操作"
	exit
else
	echo "检测到 commit message 中未包含 ${build_trigger}, 中断执行build操作"
	exit 1
fi